home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / comm / net / spakparnet_0_5.lha / srv / nfsthings_perhaps.h < prev    next >
C/C++ Source or Header  |  1992-11-09  |  3KB  |  75 lines

  1. /** SERVER DEFINES FOR THE NETWORK FILESYSTEM */
  2.  
  3. /** standard network file system request packet sent to our fileservers */
  4. struct NFSReqPkt {
  5.     long    request;        /* thing to be performed by the server */
  6.     void    *destmem;        /* where the server should DMA the result (on the other
  7.                                machine that is) 
  8.                                By convention this may be set to NULL for no response */
  9.     long    totallength;    /* total bytes to DMA back */
  10.     short    pktsize;        /* size of the packets to send it back as */
  11.     short    extra;
  12.     /* notice how this is divisible into long words */
  13. };
  14.  
  15.  
  16.  
  17. /** Following the above initial request is one of the following structures */
  18. struct NFSOpenFile {
  19. )long    action;            /* actual action we should use to open the file */
  20.     long    lock;            /* actually an index into our open lock array (or NULL) */
  21.     char    namelen;        /* bstr style name (on a long word boundary!!) */
  22.     char    name[1];        /* at least 1 character */
  23.     /* after this should come the rest of the name ALSO NULL TERMINATED! */
  24. };
  25.  
  26. /* tack the NFSOpenFile to the end of a NFSReqPkt */
  27. #define NFSOPENFILE(a) ((struct NFSOpenFile *)(&((a)[1])))
  28.  
  29.  
  30.  
  31. /** this structure is DMA'd back to the requesting machine */
  32. struct NFSOpenFileResult {
  33.     long    remote_res1;    /* actual result from operation (always have first) */
  34.     long    remote_fh;        /* index into remote array of fh's */
  35.     long    majic;            /* a majic ID number sent back */
  36. };
  37.  
  38.  
  39. /** REQUEST defines - different from the amiga dos ones! */
  40. #define REQUEST_OPENFILE    1
  41. #define REQUEST_CLOSEFILE    2
  42. #define REQUEST_READ        3
  43. #define    REQUEST_WRITE        4
  44.  
  45.  
  46. struct DosMsg {
  47.     struct StandardPacket sp;
  48.     void    (*code)(void *);            /* code to call with the *dosmsg passed in */
  49. };
  50.  
  51.  
  52. /** MACROS TO INIT STANDARD PACKETS */
  53. #define INIT_STD_PKT(stdpkt, replyport) \
  54.     \
  55.     ((stdpkt)->sp_Msg.mn_Node.ln_Type    = NT_MESSAGE,\
  56.     (stdpkt)->sp_Msg.mn_Node.ln_Name    = (char *)(&(stdpkt)->sp_Pkt),\
  57.     (stdpkt)->sp_Msg.mn_Length            = sizeof(struct StandardPacket),\
  58.     (stdpkt)->sp_Msg.mn_ReplyPort        = (stdpkt)->sp_Pkt.dp_Port = replyport,\
  59.     (stdpkt)->sp_Pkt.dp_Link            = &(stdpkt)->sp_Msg)
  60.  
  61. #define STD_PKT_ARGS1(stdpkt, replyport, action, arg1)\
  62.     ((stdpkt)->sp_Pkt.dp_Type = action,\
  63.     (stdpkt)->sp_Pkt.dp_Arg1 = arg1,\
  64.     INIT_STD_PKT(stdpkt,replyport))
  65.  
  66. #define STD_PKT_ARGS2(stdpkt, replyport, action, arg1, arg2)\
  67.     ((stdpkt)->sp_Pkt.dp_Arg2 = arg2,\
  68.     STD_PKT_ARGS1(stdpkt, replyport, action, arg1))
  69.  
  70. #define STD_PKT_ARGS3(stdpkt, replyport, action, arg1, arg2, arg3)\
  71.     ((stdpkt)->sp_Pkt.dp_Arg3 = arg3,\
  72.     STD_PKT_ARGS2(stdpkt, replyport, action, arg1, arg2))
  73.  
  74.  
  75.